package basedemo

import groovy.transform.Canonical
//toString方法,打印字段以,隔开,类名开头
@Canonical(excludes="sex")  //排除sex字段
class Person {
    String name
    Integer age
    String sex

    Person() {
        println "new yige person"
    }

    Person(String name, Integer age, String sex) {
        this.name = name
        this.age = age
        this.sex = sex
    }
    static void main(String[] args) {
        def p=new Person("侯征",25,"男")
        println p
    }
}
